import { stringify } from 'qs';
import request from '@/utils/request';


/**
 * 绑卡-查询所有会员卡
 * @param {*} params 
 */
export async function fetchAllVipCard(params) {
  return request('/memberCardController/queryAllMemberCard', {
    method: 'POST',
    data: {
      ...params
    },
  });
}

/**
 * 查询会员详情
 * @param {*} params 
 */
export async function fetchVip(params) {
  return request(`/member/memberInfo?${stringify(params)}`);
}


/**
 * 删除会员
 * @param {*} params 
 */
export async function removeVip(params) {
  return request(`/member/delete?${stringify(params)}`);
}

/**
 * 批量删除会员
 * @param {*} params 
 */
export async function batchRemoveVip(params) {
  return request(`/member/batchDeleteMember?${stringify(params, { arrayFormat: 'brackets' })}`);
}


/**
 * 新增会员
 * @param {*} params 
 */
export async function addBindVipCard(params) {
  return request('/memberCardController/memberBindCard', {
    method: 'POST',
    data: { ...params },
  });
}

/**
 * 更新会员
 * @param {*} params 
 */
export async function updateVip(params) {
  return request('/member/update', {
    method: 'POST',
    data: { ...params },
  });
}


/**
 * 根据用户信息查询场馆List
 * @param {*} params 
 */
export async function fetchShopList(params) {
  return request('/venueInfo/queryVenueInfoListByUserId', {
    method: 'POST',
    requestType:'form',
    data: { ...params },
  });
}

/**
 * 根据用户信息销售人员List
 * @param {*} params 
 */
export async function fetchSalesList(params) {
  return request('/sys/user/queryCoachAndSale', {
    method: 'POST',
    data: {
      ...params
    },
  });
}

/**
 * 查询名称或手机号查询会员
 * @param {*} params 
 */
export async function fetchMembersList(params) {
  return request('/member/selectMember', {
    method: 'POST',
    data: {
      ...params
    },
  });
}

/**
 * 查询全部的会员和卡的绑定信息
 * @param {*} params 
 */
export async function queryVipBindCard(params) {
  return request('/memberCardController/queryBindCardList', {
    method: 'POST',
    data: {
      ...params
    },
  });
}

/**
 * 查询会员的会员卡详情
 * @param {*} params 
 */
export async function getMemberCardInfo(params) {
  return request('/memberCardController/getMemberCardInfo', {
    method: 'POST',
    data: {
      ...params
    },
  });
}

/**
 * 激活卡
 * @param {*} params 
 */
export async function memberCardActivate(params) {
  return request('/memberCardController/memberCardActivate', {
    method: 'POST',
    data: {
      ...params
    },
  });
}

/**
 * 续卡
 * @param {*} params 
 */
export async function memberRenewCard(params) {
  return request('/memberCardController/memberRenewCard', {
    method: 'POST',
    data: {
      ...params
    },
  });
}

/**
 * 停卡
 * @param {*} params 
 */
export async function memberCardStop(params) {
  return request('/memberCardController/memberCardStop', {
    method: 'POST',
    data: {
      ...params
    },
  });
}

/**
 * 扣卡
 * @param {*} params 
 */
export async function memberCardDeductMoney(params) {
  return request('/memberCardController/memberCardDeductMoney', {
    method: 'POST',
    data: {
      ...params
    },
  });
}

/**
 * 次卡转换
 * @param {*} params 
 * @returns 
 */
export async function transformMemberCard(params) {
  return request('/memberCardController/transformMemberCard', {
    method: 'POST',
    data: {
      ...params
    },
  });
}